#include "colorcorrectionform.h"
#include "ui_colorcorrectionform.h"
#include <QPainter>
#include <QStyleOption>

ColorCorrectionForm::ColorCorrectionForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ColorCorrectionForm)
{
    ui->setupUi(this);
    ui->toolButton_contractExpand->setChecked(false);
    ui->widget_hide->setHidden(true);
    this->setFixedHeight(47);
    this->setProperty("form","backgroundform");
    ui->label_imageDefaultNew->setProperty("model","defalut");
}

ColorCorrectionForm::~ColorCorrectionForm()
{
    delete ui;
}

void ColorCorrectionForm::on_toolButton_contractExpand_clicked(bool checked)
{
    ui->widget_hide->setHidden(!checked);
    if(checked)
        this->setFixedHeight(150);
    else
        this->setFixedHeight(47);
}

void ColorCorrectionForm::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.init(this);
    QPainter painter(this);
    style()->drawPrimitive(QStyle::PE_Widget,&opt,&painter,this);
    QWidget::paintEvent(event);
}

void ColorCorrectionForm::on_comboBox_currentIndexChanged(const QString &arg1)
{
    ui->label_colorCorrectionType->setText(arg1);
    if(arg1 == "默认")
        ui->label_imageDefaultNew->setProperty("model","defalut");
    else
        ui->label_imageDefaultNew->setProperty("model","new");
    ui->label_imageDefaultNew->style()->unpolish(ui->label_imageDefaultNew);
    ui->label_imageDefaultNew->style()->polish(ui->label_imageDefaultNew);
    ui->label_imageDefaultNew->update();
}
